﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace MapEditor.GUI
{
    class LoadMapButton : Button
    {
        //Declare instance variable
        public bool clicked = false;

        //Constructor
        public LoadMapButton(Texture2D texture, Vector2 position) : base(texture, position)
        {

        }

        public override void Update()
        {
            clicked = base.Clicked;
            base.Update();
        }

        public override void Effect()
        {
            Game1.state = State.FREEZE;

            Forms.LoadMapForm loadmap = new Forms.LoadMapForm();
            loadmap.ShowDialog();

            if (loadmap.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                base.prevClicked = false;
            }
            else
            {
                base.prevClicked = false;
            }

            //Unfreeze the game
            Game1.state = State.PLAY;

            base.Effect();
        }
    }
}
